#ifndef INDEX_BUFFER
#define INDEX_BUFFER
#include "Interfaces/IIndexBuffer.h"
namespace gname
{
class GlIndexBuffer: public IIndexBuffer
{
protected:
	unsigned char *indexBuffer;

private:
	void        GenBuffer();
	void        DeleteBuffer();
	
	unsigned	VboCount();
	
	unsigned  iboId;
	bool      locked;
	int       usage;
	unsigned  indexCount;
	int	      indexTypeSizeInBytes;
	bool      initArrays;
	int		  indexType;
public:
	GlIndexBuffer(int indexType,int usage = 0x88E4);
	GlIndexBuffer();
	~GlIndexBuffer();
	void	Alloc	( int n );
	void	Resize	( int n );
	void	Clear	( void );
	void	Erase	(unsigned index );
	unsigned	    Size  ( void )	const;

	void IboInit();

	int	GetElementType()        const;
	int	GetIndexType()          const;
	int	GetIndexSizeInBytes()	const;
	unsigned GetId() const;

	void SetIndexData(unsigned char *data);

	unsigned int*		GetIndicesui();
	unsigned short*		GetIndicesus();
	unsigned char*		GetIndicesub();

	

	bool		Empty ()		const;
	void	    Lock();
	void	    Unlock();
	

};
}
#endif